//
//  LERemoteNotificationAlertTool.m
//  LoveExpressBusiness
//
//  Created by 刘甲奇 on 2017/6/8.
//  Copyright © 2017年 DFH. All rights reserved.
//

#import "LERemoteNotificationAlertTool.h"


@implementation LERemoteNotificationAlertTool
+ (LERemoteNotificationAlertTool *)shareInstance
{
    static LERemoteNotificationAlertTool *instance = nil;
    static dispatch_once_t once;
    _dispatch_once(&once, ^{
        instance = [[LERemoteNotificationAlertTool alloc] init];
        instance.alertMode = Shareing;
    });
    return instance;
}

- (void)play
{
    AudioServicesPlaySystemSound(sound);
}

- (void)setAlertMode:(AlertMode)alertMode
{
    switch (alertMode) {
        case Shareing:
        {
            sound = kSystemSoundID_Vibrate;
        }
            break;
        case Ring:
        {
            NSString *path = [NSString stringWithFormat:@"/System/Library/Audio/UISounds/sms-received3.caf"];
            if (path) {
                OSStatus error = AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:path],&sound);
                
                if (error != kAudioServicesNoError)
                {
                    LELog(@"%s---%d---通知播放生意出现错误--%d",__func__,__LINE__,error);
                    sound = 0;
                }
            }
        }
            break;
            
        default:
            break;
    }
    
}

@end







